import { Entity, PrimaryUuid, CreateDate, UpdateDate, Title, CardUseTo, Digdit, Desc, CardStatus, Images, Price, SysUserId, WxCardSchema, WxCardType, CardCategoryId, Tags, RichText, Boolean, CreateUserId, Cover, Jsonb, Text, DateTime } from '@sker/core'
@Entity({ name: 'card' })
export class Card {
    static title: string = `会员卡`;
    static resource: string = `wx_card`;

    @PrimaryUuid({ primaryKeyConstraintName: 'PK_CARD_ID' })
    id!: string;

    @Jsonb({
        comment: '所属分类',
        nullable: true,
        default: []
    })
    category!: string[]

    @Text({ comment: '打平分类', nullable: true, default: '' })
    category_flat!: string[]

    @Title({ label: '标题', comment: '名称' })
    title!: string;

    @Desc({ label: '简介', comment: '简介' })
    desc!: string;

    @RichText({ label: '详情' })
    content!: string;

    @Tags({ label: '标签' })
    tags!: string[]

    @CardUseTo({ label: '使用场景' })
    use_to!: string;

    @Cover({ label: '缩略图', comment: '缩略图' })
    cover!: string;

    @Images({ label: '图集', comment: '展示图片', nullable: true })
    images!: string[];

    @Price({ label: '价格', comment: '价格' })
    fee!: number;

    @WxCardType({ label: '卡券类型', comment: '兑换方式' })
    type!: string;

    @Digdit({ label: '库存', comment: '库存数量' })
    stock: number;

    @Digdit({ label: '销量', comment: '销量' })
    sales!: number;

    @Digdit({ label: '限购', comment: '限购数量，0 表示不限制' })
    maxbuy!: number;

    @CardStatus({ label: '状态' })
    status!: string;

    @Boolean({ label: '是否推荐' })
    is_recommend!: boolean;

    @Boolean({ label: '是否最新' })
    is_new!: boolean;

    @Boolean({ label: '允许转赠' })
    allow_grant!: boolean;

    @Boolean({ label: '是否实体卡' })
    is_entity!: boolean;

    @WxCardSchema({ label: '自定义' })
    schema!: object;

    @DateTime({ label: '过期时间' })
    expired_date: Date;

    @CreateUserId({ type: 'uuid', comment: '创建人' })
    create_uid!: string;

    @CreateDate({
        comment: '创建日期'
    })
    create_date!: Date;

    @UpdateDate({
        comment: '更新日期'
    })
    update_date!: Date;
}